home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / programming / amiga / visualarts / source / clipboard / clipboard_func.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-02  |  1.8 KB  |  74 lines

  1. /* C code generated by:                            */
  2. /* Visual Arts Version 2.1                        */
  3. /* Copyright (c)1994-95 Danny Y. Wong  All rights reserved        */
  4. /* Calgary, Alberta (CANADA)                                    */
  5.  
  6. extern struct Window  *ClipBoardWnd;
  7. extern struct Gadget *ClipBoardGadgets[ClipBoardNumGads];
  8. extern void CreateClipBoardLists(void);
  9. extern UBYTE *DevicesLabels[];
  10.  
  11. struct List *ClipBoardLists[1];
  12.  
  13. long gclipdevice = 0;      // global to hold the clipboard device # 0 -9
  14.  
  15. void CreateClipBoardLists(void)
  16. {
  17.   short i;
  18.  
  19.   i=0;
  20.   while (DevicesLabels[i])
  21.      AddNewNode(ClipBoardLists[0], DevicesLabels[i++]);
  22.  
  23. }
  24.  
  25.              /* gadget functions */
  26.  
  27. int writeObj(struct VAobject VAObject)
  28. {
  29.   BOOL ok;
  30.   
  31.   // get the text from the string gadget and write to clipboard
  32.   
  33.   ok = CBWriteLine(gclipdevice, GetString(ClipBoardGadgets[ID_entry]));
  34.   if (ok)
  35.   {
  36.     GT_SetGadgetAttrs(ClipBoardGadgets[ID_Display], ClipBoardWnd, NULL,
  37.        GTTX_Text, "", TAG_DONE);
  38.     GT_SetGadgetAttrs(ClipBoardGadgets[ID_entry], ClipBoardWnd, NULL,
  39.        GTST_String, "", TAG_DONE);
  40.   }
  41.   return(1L);
  42. }
  43. /*    Button  Write         */ 
  44.  
  45. int quitObj(struct VAobject VAObject)
  46. {
  47.   return(-1L);
  48. }
  49. /*    Button  Quit         */ 
  50.  
  51. int entryObj(struct VAobject VAObject)
  52. {
  53.   return(1L);
  54. }
  55. /*    String  Entry         */ 
  56.  
  57. int deviceObj(struct VAobject VAObject)
  58. {
  59.   BOOL ok;
  60.   char text[80];
  61.   
  62.   gclipdevice = VAObject.va_IntuiMsg->Code;  // get the device # from cycle
  63.   ok = CBReadLine(gclipdevice, text);        // read the clipboard
  64.   if (ok)                                    // show the retreived text
  65.     GT_SetGadgetAttrs(ClipBoardGadgets[ID_Display], ClipBoardWnd, NULL,
  66.        GTTX_Text, text, TAG_DONE);
  67.   else                                      // empty clipboard
  68.     GT_SetGadgetAttrs(ClipBoardGadgets[ID_Display], ClipBoardWnd, NULL,
  69.        GTTX_Text, "", TAG_DONE);
  70.   return(1L);
  71. }
  72. /*    Cycle  Device         */ 
  73.  
  74.